@extends('layouts.wechat.application')
@section('content')
    <div id="wrapper">
        <div class="page-search" data-log="搜索页">
            <div class="header">
                <div class="left">
                    <a href="/" title="小米商城" data-log="HEAD-首页" class="home">
                        <span class="icon-home icon"></span>
                    </a>
                </div>
                <div class="tit">
                    <div class="searchword"><input autofocus="autofocus" ></div>
                </div>
                <div class="searchlabel">
                    <a>
                        <span class="icon icon-search"></span>
                    </a>
                </div>
            </div>
            <div>
                <ul class="list-default">
                    @foreach($products as $product)
                        <li @if($product->is_top == 1)class="top" @endif
                        onclick="location.href='/product/show?id={{$product->id}}'"><span>{{$product->name}}</span></li>
                    @endforeach

                </ul>
            </div>
        </div>
    </div>
@endsection
@section('js')

    <script>
        $(function () {
            $(".icon-search").click(function () {
                var searchword = $.trim($(".searchword input").val());
                location.href = '/product/product_list?searchword=' + searchword;
//                $.ajax({
//                    type: 'GET',
//                    url: "/product/search/" + searchword,
//                    date: {searchword: searchword},
//                    success: function () {
//
//                    }
//                })
            });
        })
    </script>
@endsection


